<?php
/** 
* Classe que serve de modelo para a criação de widgets 
* 
* @author Renato Ipiranga <ripiramga@gmail.com> 
* @version 0.1
* @access public
* Mais informações ({@link https://codex.wordpress.org/Widgets_API}) 
* e ({@link http://xref.wordpress.org/branches/3.6/WordPress/Widgets/WP_Widget.html})
*/


class padrao extends WP_Widget {
	function __construct() {
		parent::__construct( 'default', 'Template de Widget', array( 'description' => 'Template para criar os widgets' ) );
	}
	
	function widget ( $args, $instance ) {
		extract($args, EXTR_SKIP);
		$title = empty ($instance['title']) ? 'Título do widget' : apply_filters('widget_title', $instance['title']);
	}
	
	function update($new_instance, $old_instance) {
		$instance = $old_instance;
		$instance['title'] = strip_tags($new_instance['title']);
		return $instance;
	}	
	
	function form ( $instance ) {
		require get_template_directory() . '/widget/widget-style.php';
		$instance = wp_parse_args((array) $instance, array('title' => ''));
		$title = strip_tags($instance['title']);		
		?>
		<p>
		  <label for="<?php echo $this->get_field_id('title');?>"><?php _e('Título:', 'tga') ?></label>
		  <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($title); ?>">
		  <span class="nota-input-box">Texto abaixo do input box</span>
		</p>		
	<?php		
	}

} //Fim do script default.php